home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 4 / The 640 Meg Shareware Studio CD-ROM Volume IV (Data Express)(1994).ISO / clang / 140_01.zip / KEY.C < prev    next >
Text File  |  1993-06-26  |  2KB  |  86 lines

  1. /*
  2. This utility will program strings under the keys in the numeric keypad
  3. on an ADM-31 terminal with version 4.00 or later firmware. The maximum
  4. number of characters that can be stored under ALL the keys is 80.
  5.  
  6. Version    1.0    Initial release in 'C', 10/March/1982    
  7.  
  8. By        Bill Bolton
  9.         Software Tools,
  10.         P.O. Box 80,
  11.         Newport Beach,
  12.         NSW, 2106,
  13.         AUSTRALIA
  14.  
  15. */
  16.  
  17. #include    BDSCIO.H
  18.  
  19. main()
  20.  
  21. {
  22.     int    i;
  23.     int    length;
  24.     char    answer;
  25.     char    string[10][80];
  26.  
  27.     /* Clear any existing programming */
  28.  
  29.     printf(CLEARS);
  30.     for(i = 0; i < 10; i++) {
  31.         printf("H%d%c!%d%s",i,ESC,i,CLEARS);
  32.         }
  33.  
  34.     /* Tell them what we are about */
  35.  
  36.     printf("ADM-31 Keypad Programming Utility, by Bill Bolton, ");
  37.     printf("Software Tools, 1982\n\n"); 
  38.     printf("This utility will program the numeric key pad");
  39.     printf(" on a Lear Siegler ADM-31\n");
  40.     printf("terminal with revision 4.xx firmware.\n\n");
  41.     printf("A maxiumum of 80 characters may be programmed");
  42.     printf(" under all keys.\n\n");
  43.     printf("If you don't want to program a key just press 'Return'.\n\n");
  44.  
  45.     /* Now fetch the strings to be programmed under keys,
  46.        if <CR> pressed, make the string the numeric value on the
  47.        key top under the key...i.e. no change */
  48.         
  49.     length = 0;
  50.     for (i = 0; i < 10; i++) {
  51.         printf("String for numeric pad key %d :",i);
  52.         gets(string[i]);
  53.         if(string[i][0] == 0)
  54.             sprintf(string[i],"%d",i);
  55.         length += strlen(string[i]);
  56.         if(length >= 80) {
  57.             printf("\nTerminal key buffer full !\7\n");
  58.             printf("Hit any key to program strings entered so");
  59.             printf(" far or Control-C to quit");
  60.             getchar();
  61.             break;
  62.             }
  63.         printf("Terminal buffer space remaining = %d\n",80 - length);
  64.         }
  65.  
  66.     /* Clear the screen */
  67.  
  68.     printf(CLEARS);
  69.  
  70.     /* Program the keys */
  71.  
  72.     for (i = 0; i < 10; i++) {
  73.         printf("H%s%c!%d%s",string[i],ESC,i,CLEARS);
  74.         }
  75.  
  76.     /* Finish up */
  77.  
  78.     printf("Do you want to enable programmed functions");
  79.     printf(" (Y/N 'Return' = Y) ");
  80.     if((answer = toupper(getchar())) != 'N') {
  81.         printf("\n%c!YKeys programmed!",ESC);
  82.         }
  83.     printf("\n\nFinished programming numeric keys.\n");
  84.     exit();
  85. }
  86.